package com.mud.mudcommune.http;

import com.mud.mudcommune.entry.ArticleResponse;
import com.mud.mudcommune.entry.BannerEntry;
import com.mud.mudcommune.entry.CaseContentResponse;
import com.mud.mudcommune.entry.CaseResponse;
import com.mud.mudcommune.entry.ChiefResponse;
import com.mud.mudcommune.entry.FeedbackResponse;
import com.mud.mudcommune.entry.SucceedResponse;
import com.mud.mudcommune.entry.SignUpEntry;
import com.mud.mudcommune.entry.LoginEntry;
import com.mud.mudcommune.entry.RegisterEntry;
import com.mud.mudcommune.entry.SubjectEntry;
import com.mud.mudcommune.entry.VRResponse;
import com.mud.mudcommune.entry.VerifyEntry;

import okhttp3.RequestBody;
import retrofit2.Call;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Headers;
import retrofit2.http.Part;
import retrofit2.http.Query;

public interface ApiService {
    int SMS_SEND_SUCCESS = 1;
    int SMS_SEND_FAILURE = -1;
    int PHONE_NUM_WRONG = -2;
    int TYPE_CASE = 1;
    int TYPE_VR = 2;
    int TYPE_RECOMMENTD = 3;
    // http://api.29hn.com/front/example/recommend
    // http://api.29hn.com/front/Article/article
    String BASE_URL = "http://api.29hn.com/";

    String SMS_BASE_URL = "http://106.ihuyi.cn/";

    String CASE_TYPE = "admin/example/index"; // 案例中的类型
    String SIGN_UP = "admin/sign_up/add";//报名的接口
    String REGISTER = "front/login/add";//注册的接口
    String LOGIN = "front/login/login";//登录的接口
    String SMS = "webservice/sms.php";
    String RECOMMENTD = "front/example/recommend";
    String CASE_CONTENT = "front/example/index_all";
    String ABOUT_US = "front/mine/index";
    String VR_CONTENT = "front/VR/index_all";
    String CASE_DETAIL = "front/example/find";
    String VR_DETAIL = "front/VR/find";
    String SUBJECT = "front/topic/index_all?page=1";//专题活动
    String ARTICLE = "front/Article/article";//新手小白指南 文章
    String FEEDBACK = "front/Fedback/add"; // 意见反馈
    String ARTICLE_DETAIL = "front/Article/find"; // 攻略里的文章详情
    String BANNER = "front/Ad"; // 轮播图
    String EXIT_LOGIN = "front/login/login_out"; // 登录退出
    String DESIGNER = "front/Plan/findPlan"; // 找设计师
    String BORROW_ADD = "front/Plan/addPlanClint"; // 浏览加一

    @Headers({
            "User-Agent: Android"
    })
    @GET(CASE_CONTENT)
    Call<CaseContentResponse> getCaseContent(
            @Query("style_id") String styleId,
            @Query("house_type_id") String houseTypeId,
            @Query("space_id") String spaceId,
            @Query("color_id") String colorId
    );

    @GET(BORROW_ADD)
    Call<SucceedResponse> addBorrow(@Query("id") int id);

    @GET(DESIGNER)
    Call<ChiefResponse> getChief(@Query("page") int page);

    @GET(EXIT_LOGIN)
    Call<RegisterEntry> getExit();

//    @FormUrlEncoded
//    @POST(FEEDBACK)
//    Call<FeedbackResponse> uploadImage(
//            @Field("msg_title") String title,
//            @Field("msg_content") String content,
//            @Field("images") String images);

//    @Multipart
//    @POST(FEEDBACK)
//    Call<FeedbackResponse> uploadImage(
//            @Part("msg_title") String title,
//            @Part("msg_content") String  content,
//            @Part("file\"; filename=\"image.png\"") RequestBody imgs);

    @Multipart
    @POST(FEEDBACK)
    Call<FeedbackResponse> uploadImage(
            @Part("msg_title") String title,
            @Part("msg_content") String  content,
            @Part("file\"; filename=\"image.png\"") RequestBody imgs);

    @Multipart
    @POST(FEEDBACK)
    Call<FeedbackResponse> upload(
            @Part("msg_title") String title,
            @Part("msg_content") String  content);

    @FormUrlEncoded
    @POST(LOGIN)
    Call<LoginEntry> Login(@Field("member_name") String member_name,
                           @Field("member_pwd") String member_pwd);

    @GET(CASE_DETAIL)
    Call<CaseContentResponse> getCaseDetails(@Query("case_id") int caseId);


    @GET(VR_DETAIL)
    Call<VRResponse> getVrDetails(@Query("vr_id") int vrId);


    @GET(SMS)
    Call<VerifyEntry> getSms(@Query("method") String method,
                             @Query("account") String account,
                             @Query("password") String phone,
                             @Query("mobile") String wechat,
                             @Query("content") String content,
                             @Query("format") String format);

    @FormUrlEncoded
    @POST(SIGN_UP)
    Call<SignUpEntry> Sign_Up(@Field("name") String name,
                              @Field("sex") String sex,
                              @Field("phone") String phone,
                              @Field("wechat") String wechat,
                              @Field("address") String address);

    @FormUrlEncoded
    @POST(REGISTER)
    Call<RegisterEntry> Register(@Field("member_name") String member_name,
                                 @Field("member_pwd") String member_pwd,
                                 @Field("phone") String phone,
                                 @Field("city") String city
    );

    // http://api.29hn.com/admin/example/index
    @GET(CASE_TYPE)
    Call<CaseResponse> getCaseType();

    @GET(RECOMMENTD)
    Call<CaseContentResponse> getRecommend();

    @GET(ABOUT_US)
    Call<CaseContentResponse> getAboutUs();

    @GET(VR_CONTENT)
    Call<VRResponse> getVRAll();

    @GET(SUBJECT)
    Call<SubjectEntry> getSubject();

    @GET(ARTICLE)
    Call<ArticleResponse> getArticle();

    @GET(ARTICLE_DETAIL)
    Call<ArticleResponse> getArticleDetail(@Query("article_id") int articleId);

    @GET(BANNER)
    Call<BannerEntry> getBanner();
}
